import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:vc_package/vc_package.dart';

class BitmapWidget extends StatelessWidget {
  final PageStatus? status;

  const BitmapWidget({super.key, this.status = PageStatus.noContent});

  @override
  Widget build(BuildContext context) {
    String statusInfo = '暂时没有内容';
    String imgSrc = 'images/bit/net_err';

    switch (status) {
      case PageStatus.netError:
        statusInfo = '网络异常,请检查网络';
        imgSrc = 'images/bit/net_err';
        break;
      case PageStatus.noContent:
        statusInfo = '暂时没有内容';
        imgSrc = 'images/bit/no_content';
        break;
      case PageStatus.noInfo:
        statusInfo = '暂时没有信息';
        imgSrc = 'images/bit/no_info';
        break;
      case PageStatus.noNet:
        statusInfo = '页面走失';
        imgSrc = 'images/bit/no_net';
        break;
      case PageStatus.noRecord:
        statusInfo = '暂时没有记录';
        imgSrc = 'images/bit/no_record';
        break;
      case PageStatus.noResult:
        statusInfo = '搜索无结果';
        imgSrc = 'images/bit/no_result';
        break;
      case PageStatus.systemError:
        statusInfo = '系统出错,请刷新';
        imgSrc = 'images/bit/system_err';
        break;
      default:
        break;
    }

    return Container(color: Colors.white,child: Center(
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          ImageView(
            src: source(imgSrc),
            width: 160.fit,
            height: 124.fit,
          ),
          TextView(
            statusInfo,
            color: ColorUtils.blackLite,
            size: 14,
            margin: EdgeInsets.only(
              top: 24,
            ),
          ),
        ],
      ),
    ),);
  }
}
